<!DOCTYPE html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0,user-scalable=no">
	<link rel="stylesheet" href="__PUBLIC__/css/style_wx.css">
	<link rel="stylesheet" href="__PUBLIC__/css/style_ng.css">
	<script src="__PUBLIC__/js/base64en_de.js"></script>
	<script src="__PUBLIC__/js/layer.m/layer.m.js"></script>
	<script src="__PUBLIC__/js/jquery-1.7.2.min.js"></script>
	<script src="__PUBLIC__/js/common.js"></script>
	<script src="__PUBLIC__/js/xxUploadImgTemplate.js"></script>
	 
	<iframe id="__WeixinJSBridgeIframe_SetResult" style="display: none;"></iframe>
    <iframe id="__WeixinJSBridgeIframe" style="display: none;"></iframe>
</head>
<style>
	.bannerbaowei{
		height:150px
	}
	.center5585{
		background-color:#ffffff
	}
	.rich_media_area_primary{
		padding:0px
	}
	.tedit_body{
		padding:0 15px;
		background-color:#fff;
	}
</style>
<html>
<body style="position:relative;margin:0 auto"><!-- onclick="" 不能删除，他是兼容苹果手机点击触发不了编辑器问题 -->
	<div id="middle_content" onclick="" class="tedit_body">
		<!-- 音乐播放 -->
		<audio loop="" src="" id="media_tym" autoplay="" preload=""></audio>
		<{$contents}>
	</div>
	<include file="Common:display_title"/>
	<include file="Common:success_bottom"/>
	<include file="Common:menu_edit_list"/>

	<input type="hidden" id="select_item">
	<input type="hidden" id="select_item_b">
	<input type="hidden" id="form_music_id" name="musc"  value="">
	<input type="hidden" id="form_music" name="music" value="">	
</body>
</html>
<script>

	<?php if($judge_wx == 1):?>
		var length = $('img').length;
		
		//替换图片
		if(length){
			for(var a = 0;a< length;a++){
				var src  = $('img').eq(a).attr('data-src');
				var type = $('img').eq(a).attr('data-type'); //获取微信图片类型
	
				if(src){
				
					var judge = src.search(/=gif/);
					if(judge != '-1'){
						type = 'gif';
					}
				
					//传递url
					$.ajax({
					   type: "POST",
					   url: "<{:U('Home/Article/file_picture')}>",
					   data: "url="+src+"&type="+type,
					   async:false,
					   success: function(msg){
						 $('img').eq(a).attr('src',msg.msg);
					   }
					});
				}
			}
		};
		var iflength = $('iframe').length;
		if(iflength){
			for(var a = 0;a< length;a++){
				var src = $('iframe').eq(a).attr('data-src');

				if($('iframe').hasClass('js_editor_vote_card')){
					//微信投票系统删除
					$('iframe.js_editor_vote_card').remove();
				}else if(typeof(src) !== 'undefined'){
					$('iframe').eq(a).attr('src',"http://mp.weixin.qq.com"+src);
				}
			}
		}
	
	//找到微信标题
	var title = $('#activity-name').text();
	$('#new_title').val($.trim(title));
	
	//微信投票隐藏
	$('#middle_content .vote_area').hide();
	
	//视频适应
	iframe_control();
	video_adapt();
	
	<?php else:?>

		<?php if($judge_alert == '1'):?>
			layer.open({
				content:'网络原因,文章内容被劫走了'
			});
			return false;			
		<?php endif;?>

	<?php endif;?>		
		//提交
		function success(){
			var content = $('#middle_content').html();
			var music_id = $('#form_music_id').val();

			var new_title = $('#new_title').val();
			$('#middle_content').find('.css_background').removeClass('css_background');
			if(new_title == ''){
				$('#banner').show();
				layer.open({
					content:'文章标题不能为空'
				});
				return false;
			}

			//如果是本站发布的文章需要跳到修改标题
			<?php if($judge_wx == 0):?>
				if($('#banner').css('display') == 'none'){
					$('#banner').show();

					return false;
				}
			<?php endif;?>


			if(new_title != ''){
				title = new_title;
			}
			$.ajax({
				type: "POST",
				url: "<{:U('Home/Article/article_submit')}>",
				data: "content="+content+"&title="+title+"&type=1"+"&music_id="+music_id,
				success: function(msg){
					//window.location.href = msg.url;
					if(msg.status == '1'){
						//用于弹出文章审核提示
						if(msg.open == '1'){
							layer.open({
								content:msg.msg,
								end:function(){
									window.location.href = msg.url;
								}
							});
						}else{
							window.location.href = msg.url;
						}
	   	               
					}else{
						layer.open({
							content:msg.msg
						});
					}
				}
			});
		}

		//显示 删除
		function success_show(){
			if($(".tedit_body *").hasClass('eing')){
				layer.open({
					content:'请取消编辑器在保存'
				});
				return false;
			}
			
			if($('#new_title').val() != ''){
				$('#affirm').click();
				return false;
			}
			$('#banner').show();
			$('body,html').addClass('ovfHiden');
			$('#new_title').focus();
			return false;
		}
</script>



